<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<form:form modelAttribute="course">
<center>
<h1>Course edit</h1>

<form:errors path="*" cssClass="errors"/>

<table border="1">
	<tr>
		<td>name</td>
		<td><form:input path="name" size="30" maxlength="80"/></td>
	</tr>
	<tr>
		<td>info</td>
		<td><form:textarea path="info"/></td>
    </tr>
    <tr>
		<td>discipline</td>
        <td><form:select path="discipline" items="${disciplines}" itemLabel="shortName" itemValue="id"/></td>
    </tr>

    <tr>
		<td colspan="2">
			<c:choose>
				<c:when test="${course.new}">
					<a href="courseList.htm">Cancel</a>
				</c:when>
				<c:otherwise>
					<a href="courseView.htm?id=${course.id}">Cancel</a>
                </c:otherwise>
			</c:choose>
		<a href="#" onclick="javascript:document.forms['course'].submit();">Save</a></td>
	</tr>
</table>

</center>
</form:form>